package com.yjz.jvm.getResource;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.io.InputStream;
import java.net.URL;
import java.sql.Driver;

@Slf4j
public class GetResourceTest {
  private static final String PREFIX = "META-INF/services/";

  /**
   * 查找mysql驱动
   */
  @Test
  public void getResource(){
    ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
    URL url=classLoader.getResource(PREFIX + Driver.class.getName());
    InputStream inputStream=classLoader.getResourceAsStream(PREFIX + Driver.class.getName());
  }
}
